package com.ktjy.ktmall.service.impl;

import com.ktjy.ktmall.dao.RoleDao;
import com.ktjy.ktmall.dao.UserDao;
import com.ktjy.ktmall.dao.impl.RoleDaoImpl;
import com.ktjy.ktmall.dao.impl.UserDaoImp;
import com.ktjy.ktmall.entity.Role;
import com.ktjy.ktmall.entity.User;
import com.ktjy.ktmall.service.RoleService;
import com.ktjy.ktmall.service.UserService;

import java.util.Collections;
import java.util.List;

public class RoleServiceImpl implements RoleService {

    RoleDao roleDao = new RoleDaoImpl();


    @Override
    public int insertRole(Role role) {
        return roleDao.insertRole(role);
    }

    @Override
    public int updateRole(Role role) {
        return roleDao.updateRole(role);
    }

    @Override
    public int deleteRole(Integer id) {
        return roleDao.deleteRole(id);
    }

    @Override
    public Role selectRoleById(int id) {
        return roleDao.selectRoleById(id);
    }

    @Override
    public List<Role> getRoleListPage(Integer currPageNo, Integer pageSize) {
        Integer from = (currPageNo - 1) * pageSize;
        return roleDao.getRoleListPage(from, pageSize);
    }

    @Override
    public int count() {
        return roleDao.count();
    }
}
